﻿using System;
using System.Runtime.InteropServices;

namespace Kay.Nuget.Helper.WindowsApi
{
    public static class Api
    {
        /// <summary>
        /// 根据参数获取图标
        /// </summary>
        /// <param name="siid"></param>
        /// <param name="uFlags"></param>
        /// <param name="psii"></param>
        /// <returns></returns>
        [DllImport("shell32.dll", SetLastError = false)]
        public static extern int SHGetStockIconInfo(Shstockiconid siid, Shgsi uFlags, ref Shstockiconinfo psii);

        /// <summary>
        /// 向控件绘制管理员盾牌图标
        /// </summary>
        /// <param name="hWnd">控件句柄</param>
        /// <param name="msg">消息ID</param>
        /// <param name="wParam"></param>
        /// <param name="lParam"></param>
        /// <returns></returns>
        /// <remarks>
        /// 调用方式
        /// SendMessage(button1.Handle, BcmSetshield, 0, (IntPtr)1);
        /// </remarks>
        [DllImport("user32", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern int SendMessage(IntPtr hWnd, uint msg, int wParam, IntPtr lParam);
    }
}